<!-- 修改密码表单 -->
<form class="layui-form model-form">
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">@lang('system.index.old'):</label>
        <div class="layui-input-block">
            <input type="password" name="old" placeholder="@lang('system.index.tips.old')" class="layui-input"
                   lay-verType="tips" lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">@lang('system.index.password'):</label>
        <div class="layui-input-block">
            <input type="password" name="password" placeholder="@lang('system.index.tips.password')" class="layui-input"
                   lay-verType="tips" lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">@lang('system.index.password_confirmation'):</label>
        <div class="layui-input-block">
            <input type="password" name="password_confirmation" placeholder="@lang('system.index.tips.password_confirmation')" class="layui-input"
                   lay-verType="tips" lay-verify="required" lay-equalTo="input[name=password]" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block text-right">
            <button class="layui-btn" lay-filter="submit-psw" lay-submit>@lang('common.save')</button>
            <button class="layui-btn layui-btn-primary" type="button"
                    ew-event="closeDialog">@lang('common.cancel')</button>
        </div>
    </div>
</form>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'admin', 'formX'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;

        // 监听提交
        form.on('submit(submit-psw)', function (data) {
            SystemUtil.ajax("{{admin_url('index/changePassword')}}").setData(data.field).send(3).done(() => {
                admin.closeDialog('[lay-filter="submit-psw"]');
            });
            return false;
        });

    });
</script>
